--影骇响震
local yinghaixiangzheng = fk.CreateSkill{
    name = "mcdh_yinghaixiangzheng",
    frequency = Skill.Limited,
    scope_type = Player.HistoryPhase
}

yinghaixiangzheng:addEffect('active',{
    can_use = function(self, player)
        return player:usedSkillTimes(self.name, Player.HistoryGame) == 0
    end,
    card_filter = Util.FalseFunc,
    target_num = 2,
    target_filter = function (self, to_select, selected)
        local target = Fk:currentRoom():getPlayerById(to_select)
        if #selected == 0 then
            return true
        elseif #selected == 1 then
            return Fk:currentRoom():getPlayerById(selected[1]):canMoveCardsInBoardTo(target, nil)
        end
    end,
    on_use =function(self, room, effect)
        local player = room:getPlayerById(effect.from)
        local result = room:askForMoveCardInBoard(player, room:getPlayerById(effect.tos[1]), room:getPlayerById(effect.tos[2]), self.name)
        local events = player.room.logic:getEventsByRule(GameEvent.MoveCards, 1, function(e)
            for _, move in ipairs(e.data) do
                if move.skillName == self.name then
                    return true
                end
            end
        end,player.room.logic:getCurrentEvent():findParent(GameEvent.Phase, true).id)
        if #events > 0 then
            for _, move in ipairs(events[1].data) do
                if move.skillName == self.name then
                    for _, info in ipairs(move.moveInfo) do
                        if info.fromArea == Card.PlayerEquip  then
                            U.askForUseVirtualCard(room, room:getPlayerById(move.from), "slash", nil, self.name, "#mcdh_yinghaixiangzheng_use", false, true, false, true, nil, false)
                            break
                        end
                    end
                end
            end
        end
    end
})

return yinghaixiangzheng


